package com.jghz.transfer.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import com.jghz.framework.exception.AppException;
import com.jghz.transfer.service.LoginkService;

@Aspect
@Component
public class SendMessageAspect {

	@Pointcut("execution(* com.jghz.transfer..*.*Service.*send*(..))")
	public void setJoinPoint() {
	}

	@Around("setJoinPoint()")
	public void doExecuteSend(ProceedingJoinPoint joinPoint) throws Exception {
		LoginkService.checkToken();
		try {
			joinPoint.proceed();
		} catch (Throwable e) {
			throw new AppException(e.getMessage());
		}
	}

}
